﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using KenLib.BusinessManager;
using DataInfo;
using System.Collections.Generic;

public partial class JOINT_frmJ_TraineeInterviewList : System.Web.UI.Page
{

    応募学歴情報Manager _応募学歴情報Manager = new 応募学歴情報Manager();
    frmJ_InterviewResultCheckManager _frmJ_InterviewResultCheckManager = new frmJ_InterviewResultCheckManager();
   
    protected void Page_Load(object sender, EventArgs e)
    {
        ((JOINT_MstPage_JOINT)this.Master).HideLiArea("frmJ_TraineeInterviewList");

        if (!IsPostBack)
        {
            if (Session["役"] == null || Session["役"].ToString() == "")
            {
                Response.Redirect("~/frmD_Login.aspx");
            }
            if (Session["役"] == null || Session["役"].ToString() == "1")
            {
                Response.Redirect("~/frm_MJointCompManager.aspx");
            }

            if (Session["redirectMode"] != null)
            {
                if (Session["redirectMode"].ToString() == "1")
                {
                    HiddenField1.Value = "1";
                    ((JOINT_MstPage_JOINT)this.Master).changeTitle("来社時　情報確認・修正");
                }
                else if (Session["redirectMode"].ToString() == "2")
                {
                    HiddenField1.Value = "2";
                    ((JOINT_MstPage_JOINT)this.Master).changeTitle("来社後　情報確認・修正");
                }
            }
            else
            {
                Response.Redirect("frmJ_TraineeManager.aspx");
            }
            
            
            Session["arrayLinkDisable"] = new ArrayList();// Array luu danh sach cac LinkButton bi khoa
            Session["arrayDropDownListChoosen"] = new ArrayList();//array luu danh sach dong ma DropDownList da thay doi du lieu
            Session["arrayDropDownListValueChoosen"] = new ArrayList();//array luu danh sach cac gia tri cua DropDownList duoc chon
            string strHeader = "氏名,ID番号,生年月日,組合名,企業名,在日親族有無,受付状態,myID";
            ShowGridViewNotClassEmpty(grv, strHeader, "データーがありません。");
            LoadErrorMessage();
            ddl_来社日.Focus();
            GetTimeDropDownList();
        }
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Event: Button click 決定 (Search)
    /// Status: OK
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn決定_Click(object sender, EventArgs e)
    {
        //string date = "";
        //int 企業ID = 0;
        //string time = "";
        //if (ddl_来社日.SelectedValue.ToString() != "-1")
        //{
        //    string[] arrDate = ddl_来社日.SelectedValue.ToString().Split(',');
        //    date = arrDate[0];
        //    企業ID = Convert.ToInt32(arrDate[1]);
        //    time = ddl_来社時間時.SelectedValue.ToString() + ddl_来社時間分.SelectedValue.ToString();
        //}
        //ShowSearch(date, time, 企業ID);
    }

    protected void grv_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grv.PageIndex = e.NewPageIndex;
        string date = "";
        int 企業ID = 0;
        string time = "";
        if (ddl_来社日.SelectedValue.ToString() != "-1")
        {
            string[] arrDate = ddl_来社日.SelectedValue.ToString().Split(',');
            date = arrDate[0];
            企業ID = Convert.ToInt32(arrDate[1]);
            time = ddl_来社時間時.SelectedValue.ToString() + ddl_来社時間分.SelectedValue.ToString();
        }
        ShowSearch(date, time, 企業ID);
    }

    protected void grv_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Control ctrl1 = e.Row.FindControl("ddl_受付状態");
            if (ctrl1 != null)
            {
                DropDownList dd = ctrl1 as DropDownList;
                string date = "";
                int 企業ID = 0;
                string time = "";
                if (ddl_来社日.SelectedValue.ToString() != "-1")
                {
                    string[] arrDate = ddl_来社日.SelectedValue.ToString().Split(',');
                    date = arrDate[0];
                    企業ID = Convert.ToInt32(arrDate[1]);
                    time = ddl_来社時間時.SelectedValue.ToString() + ddl_来社時間分.SelectedValue.ToString();
                }
                DataTable dt = frmJ_TraineeInterviewList_Search(date, time, 企業ID);

                if (dt.Rows.Count > 0)
                {
                    int row = e.Row.RowIndex;
                    string str受付状態 = dt.Rows[row]["受付状態"].ToString();
                    string str受付状態内容 = dt.Rows[row]["受付状態内容"].ToString();
                    if (str受付状態 == "0" && str受付状態内容 != "")
                    {
                        ListItem lst1 = new ListItem("連絡あり", "連絡あり");
                        ListItem lst2 = new ListItem("連絡なし", "連絡なし");
                        ListItem lst3 = new ListItem("[選択]", "[選択]");
                        dd.Items.Add(lst1);
                        dd.Items.Add(lst2);
                        dd.Items.Add(lst3);
                        dd.SelectedIndex = 0;
                        if (Session["redirectMode"] != null && Session["redirectMode"].ToString()=="1")
                        {
                            //dd.Enabled = false;
                            LinkButton lnk1 = (LinkButton)e.Row.FindControl("lbtn_氏名");
                            if (lnk1 != null)
                            {
                                lnk1.Enabled = true;
                            }
                        }

                    }
                    else if (str受付状態 == "0" && str受付状態内容 == "")
                    {
                        ListItem lst1 = new ListItem("連絡あり", "連絡あり");
                        ListItem lst2 = new ListItem("連絡なし", "連絡なし");
                        ListItem lst3 = new ListItem("[選択]", "[選択]");
                        dd.Items.Add(lst1);
                        dd.Items.Add(lst2);
                        dd.Items.Add(lst3);
                        dd.SelectedIndex = 1;
                        if (Session["redirectMode"] != null && Session["redirectMode"].ToString() == "1")
                        {
                            dd.Enabled = false;
                            LinkButton lnk1 = (LinkButton)e.Row.FindControl("lbtn_氏名");
                            if (lnk1 != null)
                            {
                                lnk1.Enabled = false;
                            }
                           
                            
                        }
                    }
                    else if (str受付状態 == "1" || str受付状態 == "9")
                    {
                        ListItem lst1 = new ListItem("連絡あり", "連絡あり");
                        ListItem lst2 = new ListItem("連絡なし", "連絡なし");
                        ListItem lst3 = new ListItem("[選択]", "[選択]");
                        dd.Items.Add(lst1);
                        dd.Items.Add(lst2);
                        dd.Items.Add(lst3);
                        dd.SelectedIndex = 2;

                        if (Session["redirectMode"] != null && Session["redirectMode"].ToString() == "1")
                        {
                            //dd.Enabled = false;
                            LinkButton lnk1 = (LinkButton)e.Row.FindControl("lbtn_氏名");
                            if (lnk1 != null)
                            {
                                lnk1.Enabled = true;
                            }
                        }
                    }


                    // Xu ly hien thi lai trang thai LinkButton disable khi nhan nut Search  lai
                    bool check = Session["arrayLinkDisable"] != null ? true : false;
                    if (check)
                    {
                        ArrayList currentLinkDisable = (ArrayList)Session["arrayLinkDisable"];

                        for (int i = 0; i < currentLinkDisable.Count; i++)
                        {
                            string key = currentLinkDisable[i].ToString();
                            Label lbl = (Label)e.Row.FindControl("lblmyID");
                            string value = lbl.Text.ToString();
                            if (value == key)
                            {
                                LinkButton lnk = (LinkButton)e.Row.FindControl("lbtn_氏名");
                                lnk.Enabled = false;
                            }
                        }
                    }

                    bool checkDropDownList = Session["arrayDropDownListChoosen"] != null ? true : false;
                    if (checkDropDownList)
                    {
                        ArrayList currentDropDownListChoosen = (ArrayList)Session["arrayDropDownListChoosen"];
                        ArrayList currentDropDownListValueChoosen = (ArrayList)Session["arrayDropDownListValueChoosen"];
                        for (int k = 0; k < currentDropDownListChoosen.Count; k++)
                        {
                            Label lbl = (Label)e.Row.FindControl("lblmyID");
                            string key = lbl.Text;
                            string index = currentDropDownListChoosen[k].ToString();
                            string valueIndex = currentDropDownListValueChoosen[k].ToString();

                            if (key == index)
                            {
                                DropDownList ddl = (DropDownList)e.Row.FindControl("ddl_受付状態");
                                ddl.SelectedIndex = Int32.Parse(valueIndex);
                            }
                        }
                    }
                }
            }
        }
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Update or Insert data to table 応募状態
    /// Status: Not chekc
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ddl_受付状態_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl = (DropDownList)sender;
        string temp = ddl.SelectedValue.ToString();
        GridViewRow rows = (GridViewRow)ddl.NamingContainer;
        int index = rows.RowIndex;
        string ID = grv.DataKeys[index].Value.ToString();
        if (Session["redirectMode"] != null)
        {
            frmJ_InterviewResultCheckManager _manager = new frmJ_InterviewResultCheckManager();
            if (temp.Equals("連絡あり") == true)
            {
                Session["応募状態_key"] = ID;
                this.ModalPopupMessageBox2.Show();
                txt_現住所.Text = "";
                txt_現住所.Focus();
                LinkButton lk = (LinkButton)rows.FindControl("lbtn_氏名");
                lk.Enabled = true;
            }
            //2.-------------------------------
            if (temp.Equals("連絡なし") == true)
            {
                if (frmJ_TraineeInterviewList_CheckExistsID(ID)) //Exists
                {
                    int 応募情報ID = Convert.ToInt32(ID);
                    DateTime 変更年月日 = DateTime.Now;
                    int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                    if (frmJ_TraineeInterviewList_Update_Case4(応募情報ID, 変更年月日, 変更ユーザ) != 1)
                    {
                        return;
                    }
                    
                }
                else // Not exists
                {
                    int 応募情報ID = Convert.ToInt32(ID);
                    DateTime 登録年月日 = DateTime.Now;
                    int 登録ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                    DateTime 変更年月日 = DateTime.Now;
                    int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                    if (frmJ_TraineeInterviewList_Insert_Case3(応募情報ID, 登録年月日, 登録ユーザ, 変更年月日, 変更ユーザ) != 1)
                    {
                        return;
                    }
                }

                // ask Mr Thinh
                LinkButton lk = (LinkButton)rows.FindControl("lbtn_氏名");
                lk.Enabled = false;
                ArrayList tempLinkDisable = new ArrayList();
                ArrayList currentLinkDisable = (ArrayList)Session["arrayLinkDisable"];
                for (int i = 0; i < currentLinkDisable.Count; i++)
                {
                    tempLinkDisable.Add(currentLinkDisable[i].ToString());
                }
                tempLinkDisable.Add(ID.ToString());
                Session["arrayLinkDisable"] = tempLinkDisable;
            }

            if (temp.Equals("[選択]") == true)
            {
                if (frmJ_TraineeInterviewList_CheckExistsID(ID)) // Exists
                {
                    int 応募情報ID = Convert.ToInt32(ID);
                    DateTime 変更年月日 = DateTime.Now;
                    int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                    if (frmJ_TraineeInterviewList_Update_Case6(応募情報ID, 変更年月日, 変更ユーザ) != 1)
                    {
                        return;
                    }

                }
                else
                {
                    int 応募情報ID = Convert.ToInt32(ID);
                    DateTime 変更年月日 = DateTime.Now;
                    int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                    if (frmJ_TraineeInterviewList_Insert_Case5(応募情報ID, 変更年月日, 変更ユーザ) != 1)
                    {
                        return;
                    }
                }
                LinkButton lk = (LinkButton)rows.FindControl("lbtn_氏名");
                lk.Enabled = true;
            }

            // Luu thong tin dong Dropdownlist duoc chon trong GridView
            ArrayList currentDropDownListChoosen = (ArrayList)Session["arrayDropDownListChoosen"];
            ArrayList tempDropDownListChoosen = new ArrayList();
            ArrayList currentDropDownListValueChoosen = (ArrayList)Session["arrayDropDownListValueChoosen"];
            ArrayList tempDropDownListValueChoosen = new ArrayList();

            for (int k = 0; k < currentDropDownListChoosen.Count; k++)
            {
                tempDropDownListChoosen.Add(currentDropDownListChoosen[k].ToString());
                tempDropDownListValueChoosen.Add(currentDropDownListValueChoosen[k].ToString());
            }
            tempDropDownListChoosen.Add(ID);
            tempDropDownListValueChoosen.Add(ddl.SelectedIndex.ToString());
            Session["arrayDropDownListChoosen"] = tempDropDownListChoosen;
            Session["arrayDropDownListValueChoosen"] = tempDropDownListValueChoosen;
        }
        //-------------------------------------------------2-----------------------------------------------------------------------
    }

    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (Session["redirectMode"] != null && Session["応募状態_key"] != null)
        {
            if (Session["redirectMode"].ToString() == "1")
            {
                
                if (frmJ_TraineeInterviewList_CheckExistsID(Session["応募状態_key"].ToString())) // Exists
                {
                    int 応募情報ID = Convert.ToInt32(Session["応募状態_key"].ToString());
                    DateTime 変更年月日 = DateTime.Now;
                    int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);

                    if (frmJ_TraineeInterviewList_Insert_Case7(応募情報ID, 変更年月日, 変更ユーザ) == 1)
                    {
                        Response.Redirect("frmJ_TraineeResumeBInput.aspx?id=" + 応募情報ID);
                    }
                }
                else // Not exists
                {
                    int 応募情報ID = Convert.ToInt32(Session["応募状態_key"].ToString());
                    DateTime 変更年月日 = DateTime.Now;
                    int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                    if (frmJ_TraineeInterviewList_Insert_Case5(応募情報ID, 変更年月日, 変更ユーザ)==1)
                    {
                        Response.Redirect("frmJ_TraineeResumeBInput.aspx?id=" + 応募情報ID);
                    }
                }
                
            }
        }
    }

    protected void btn_保存_Click(object sender, EventArgs e)
    {
        if (Session["redirectMode"] != null && Session["応募状態_key"] != null)
        {
            //Check exists ID in table 応募状態
            if (frmJ_TraineeInterviewList_CheckExistsID(Session["応募状態_key"].ToString())) // Exists
            {
                //Update
                int 応募情報ID = Convert.ToInt32(Session["応募状態_key"]);
                DateTime 変更年月日 = DateTime.Now;
                int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                string 来社せず理由内容 = txt_現住所.Text;
                if (frmJ_TraineeInterviewList_Update_Case2(応募情報ID, 変更年月日, 変更ユーザ, 来社せず理由内容) != 1)
                {
                    return;
                }
            }
            else // Not exists
            {
                //Insert
                int 応募情報ID = Convert.ToInt32(Session["応募状態_key"]);
                DateTime 登録年月日 = DateTime.Now;
                int 登録ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                DateTime 変更年月日 = DateTime.Now;
                int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                string 来社せず理由内容 = txt_現住所.Text;
                if (frmJ_TraineeInterviewList_Insert_Case1(応募情報ID, 登録年月日, 登録ユーザ, 変更年月日, 変更ユーザ, 来社せず理由内容) != 1)
                {
                    return;
                }
            }
        }
    }

    /// <summary>
    /// Chuyen tu kieu 0, 1 sang Boolean: False, True
    /// </summary>
    /// <param name="flag"></param>
    /// <returns></returns>
    public bool ConvertType(object flag)
    {
        if (flag == null || flag.ToString() == "")
        {
            return false;
        }
        string result = "";
        result = flag.ToString();
        if (result == "True")
            return true;
        return false;
    }

    /// <summary>
    /// Xu ly ket qua hien thi cho gridview
    /// </summary>
    /// <param name="obj"></param>
    /// <returns></returns>
    public string ConvertType2(object obj)
    {
        string result = "";
        result = obj.ToString();
        if (result == "0")
            return "博士";
        if (result == "1")
            return "修士";
        if (result == "2")
            return "学士";
        if (result == "3")
            return "高専";
        if (result == "4")
            return "高校";
        if (result == "5")
            return "中学";
        return "";
    }

   

    /// <summary>
    /// Xu ly khi click vao HyperLink
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lbtn_氏名_Click(object sender, EventArgs e)
    {
        LinkButton lbtn = (LinkButton)sender;
        GridViewRow rows = (GridViewRow)lbtn.NamingContainer;
        DropDownList ddl = (DropDownList)rows.FindControl("ddl_受付状態");
        string temp1 = ddl.SelectedValue.ToString();
        string key = grv.DataKeys[rows.RowIndex].Value.ToString();

        // Go to page frmJ_TraineeResumeAInput.aspx
        if (Session["redirectMode"] != null && Session["redirectMode"].ToString() == "2")
        {
            Response.Redirect("frmJ_TraineeResumeAInput.aspx?id=" + key);
        }

        if (Session["redirectMode"] != null && Session["redirectMode"].ToString() == "1")
        {
            if (temp1.Equals("連絡あり") == true)
            {
                Session["応募状態_key"] = "";
                Session["応募状態_key"] = key.ToString();
                lblTextMessageShow.Text = "現在の受付状態は連絡ありです、来るの状態を変更しますか？";
                this.ModalPopupMessageBox1.Show();
            }
            //2.-------------------------------
            if (temp1.Equals("連絡なし") == true)
            {
                Session["応募状態_key"] = "";
                Session["応募状態_key"] = key.ToString();
                lblTextMessageShow.Text = "現在の受付状態は連絡なしです、来るの状態を変更しますか？";
                this.ModalPopupMessageBox1.Show();
            }
            //1.+.+.+.+..........................................
            if (temp1.Equals("[選択]") == true)
            {
                if (frmJ_TraineeInterviewList_CheckExistsID(key)) // Exists
                {
                    int 応募情報ID = Convert.ToInt32(key);
                    DateTime 変更年月日 = DateTime.Now;
                    int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);

                    if (frmJ_TraineeInterviewList_Insert_Case7(応募情報ID, 変更年月日, 変更ユーザ) == 1)
                    {
                        Response.Redirect("frmJ_TraineeResumeBInput.aspx?id=" + 応募情報ID);
                    }
                }
                else // Not exists
                {
                    int 応募情報ID = Convert.ToInt32(key);
                    DateTime 変更年月日 = DateTime.Now;
                    int 変更ユーザ = Convert.ToInt32(Session["frmD_Login_ユーザID"]);
                    if (frmJ_TraineeInterviewList_Insert_Case5(応募情報ID, 変更年月日, 変更ユーザ) == 1)
                    {
                        Response.Redirect("frmJ_TraineeResumeBInput.aspx?id=" + 応募情報ID);
                    }
                }
            }
        }
    }

    /// <summary>
    /// Coder: Van Hoat
    /// Function: Cut string when string too long
    /// Status: Ok
    /// </summary>
    public string ShowTextLength(object str)
    {
        if (str == null || str.ToString() == "")
        {
            return "";
        }
        string temp = str.ToString();
        if (checkContainsUnicodeCharacter(temp))
        {
            //　ニホンゴ
            if (temp.Length > 10)
            {
                temp = temp.Substring(0, 10) + "...";
            }
        }
        else　//ベトナム
        {
            if (temp.Length > 20)
            {
                temp = temp.Substring(0, 20) + "...";
            }
        }
        return temp;
    }

    /// <summary>
    /// Coder: Van Hoat
    /// Function: Check character 1 byte or 2 byte
    /// Status: OK
    /// </summary>
    public bool checkContainsUnicodeCharacter(string input)
    {
        const int MaxAnsiCode = 255;
        char[] a = input.ToCharArray();
        for (int i = 0; i < a.Length; i++)
        {
            if (a[i] > MaxAnsiCode)
            {
                return true;
            }
        }
        return false;
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Load gridview empty
    /// Stauts:OK
    /// </summary>
    /// <param name="grv"></param>
    /// <param name="strTableHeader"></param>
    /// <param name="strEmpty"></param>
    public void ShowGridViewNotClassEmpty(GridView grv, string strTableHeader, string strEmpty)
    {
        DataTable dt = new DataTable();
        string[] arrColumnNames = strTableHeader.Split(',');
        foreach (string str in arrColumnNames)
        {
            dt.Columns.Add(str);
        }
        grv.ShowFooter = false;
        DataRow r = dt.NewRow();
        dt.Rows.InsertAt(r, 0);
        grv.DataSource = dt;
        grv.DataBind();
        grv.Rows[0].Cells.Clear();
        TableCell cell = new TableCell();
        cell.ColumnSpan = grv.Columns.Count + 1;
        cell.Text = strEmpty;
        grv.Rows[0].Cells.Add(cell);

    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Get error from database
    /// Status: OK
    /// </summary>
    /// <param name="p"></param>
    /// <returns></returns>
    private string GetError(string p)
    {
        Error er = new Error();
        er.ErrorID = p;
        ErrorManager frm_error = new ErrorManager();
        DataTable dt = frm_error.getError(er);
        return dt.Rows[0][2].ToString();
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Load error message for control
    /// Status: OK
    /// </summary>
    private void LoadErrorMessage()
    {
        RequiredFieldValidator1.ErrorMessage = GetError("ER00001");
        //CustomValidator1.ErrorMessage =  GetError("ER00002");
        RequiredFieldValidator2.ErrorMessage = GetError("ER00007");
        RequiredFieldValidator3.ErrorMessage = GetError("ER00007");
    }

    /// <summary>
    /// Hien thi ket qua tim kiem
    /// </summary>
    private void ShowSearch(string date, string time, int 企業ID)
    {
        DataTable dt = frmJ_TraineeInterviewList_Search(date, time, 企業ID);
        if (dt.Rows.Count > 0)
        {
            grv.DataSource = dt;
            grv.DataBind();
        }
        else
        {
            string strHeader = "氏名,ID番号,生年月日,組合名,企業名,在日親族有無,受付状態,myID";
            ShowGridViewNotClassEmpty(grv, strHeader, "データーがありません。");
        }
    }

    /// <summary>
    /// Coder: Van Hoat
    /// Function: Load time for dropdownlist
    /// Status: OK
    /// </summary>
    protected void GetTimeDropDownList()
    {
        DataTable dt = _応募学歴情報Manager.getTimeTraineeInterviewList();
        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string ID = dt.Rows[i]["ID"].ToString();
                string 来社日 = dt.Rows[i]["来社日"].ToString();
                string 企業名 = dt.Rows[i]["企業名"].ToString();
                string 企業ID = dt.Rows[i]["企業ID"].ToString();
                if (来社日.Length > 0)
                {
                    来社日 = 来社日.Substring(0, 10);
                }
                ListItem lst = new ListItem(来社日 + " " + 企業名, 来社日 + "," + 企業ID);
                ddl_来社日.Items.Add(lst);
            }
        }
    }

    
    /// <summary>
    /// Coder: Van Hoat
    /// Event: Selected changed dropdownlist 来社日 load data for dropdownlist ddl_来社時間時 and ddl_来社時間分
    /// Status: OK
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ddl_来社日_SelectedIndexChanged(object sender, EventArgs e)
    {
        string date = "";
        int 企業ID = 0;
        string time = "";
        if (ddl_来社日.SelectedValue.ToString() != "-1")
        {
            string[] arrDate = ddl_来社日.SelectedValue.ToString().Split(',');
            date = arrDate[0];
            企業ID = Convert.ToInt32(arrDate[1]);
        }
        
        ddl_来社時間時.Items.Clear();
        ddl_来社時間分.Items.Clear();
        List<ListItem> _lstGio = new List<ListItem>();
        List<ListItem> _lstPhut = new List<ListItem>();
        DataTable dt = select_Hours_With_Date_JS10_Vh(date);
        if (dt.Rows.Count > 0)
        {
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
                string Hours = dt.Rows[0]["来社時期"].ToString();
                if (Hours.Length > 0)
                {
                    string gio = Hours.Substring(0, 2);
                    string phut = Hours.Substring(2, 2);
                    ListItem lstGio = new ListItem(gio, gio);
                    ListItem lstPhut = new ListItem(phut, phut);
                    _lstGio.Add(lstGio);
                    _lstPhut.Add(lstPhut);
                }
            //}
            ddl_来社時間時.Items.AddRange(_lstGio.ToArray());
            ddl_来社時間分.Items.AddRange(_lstPhut.ToArray());
        }
        else
        {
            ListItem item = new ListItem("[選択]", "-1");
            item.Selected = true;
            ddl_来社時間時.Items.Insert(0, item);
            ddl_来社時間分.Items.Insert(0, item);
        }
        time = ddl_来社時間時.SelectedValue.ToString() + ddl_来社時間分.SelectedValue.ToString();
        ShowSearch(date, time, 企業ID);
        ddl_来社日.Focus();
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Search data
    /// Status: OK
    /// </summary>
    /// <param name="date"></param>
    /// <param name="time"></param>
    /// <returns></returns>
    public DataTable frmJ_TraineeInterviewList_Search(string date, string time, int 企業ID)
    {
        return _応募学歴情報Manager.frmJ_TraineeInterviewList_Search(date, time, 企業ID);
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Get Hour with pram Date  from table 面接情報, 
    /// </summary>
    /// <param name="date"></param>
    /// <returns></returns>
    protected DataTable select_Hours_With_Date_JS10_Vh(string date)
    {
        return _応募学歴情報Manager.select_Hours_With_Date_JS10_Vh(date);
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Check exists ID in table 応募状態
    /// Status: OK
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    protected bool frmJ_TraineeInterviewList_CheckExistsID(string id)
    {
        return _frmJ_InterviewResultCheckManager.frmJ_TraineeInterviewList_CheckExistsID(id);    
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Insert data to table 応募状態 with case = 1 (document)
    /// Status: OK
    /// </summary>
    /// <param name="応募情報ID"></param>
    /// <param name="date登録年月日"></param>
    /// <param name="Id登録ユーザ"></param>
    /// <param name="date変更年月日"></param>
    /// <param name="Id変更ユーザ"></param>
    /// <param name="来社せず理由内容"></param>
    /// <returns></returns>
    public int frmJ_TraineeInterviewList_Insert_Case1(int 応募情報ID, DateTime 登録年月日, int 登録ユーザ, DateTime 変更年月日, int 変更ユーザ, string 来社せず理由内容)
    {
        if (_frmJ_InterviewResultCheckManager.frmJ_TraineeInterviewList_Insert_Case1(応募情報ID, 登録年月日, 登録ユーザ, 変更年月日, 変更ユーザ, 来社せず理由内容) == 1)
            return 1;
        return 0;
    }

    /// <summary>
    /// Coder: Thanh Dong: 
    /// Function: Update data to table 応募状態 with case = 2 (document)
    /// Status: OK
    /// </summary>
    /// <param name="応募情報ID"></param>
    /// <param name="変更年月日"></param>
    /// <param name="変更ユーザ"></param>
    /// <param name="来社せず理由内容"></param>
    /// <returns></returns>
    public int frmJ_TraineeInterviewList_Update_Case2(int 応募情報ID, DateTime 変更年月日, int 変更ユーザ, string 来社せず理由内容)
    {
        if (_frmJ_InterviewResultCheckManager.frmJ_TraineeInterviewList_Update_Case2(応募情報ID, 変更年月日, 変更ユーザ, 来社せず理由内容) == 1)
            return 1;
        return 0;
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Insert data to table 応募状態 with case = 3 (document)
    /// Status: OK
    /// </summary>
    /// <param name="応募情報ID"></param>
    /// <param name="登録年月日"></param>
    /// <param name="登録ユーザ"></param>
    /// <param name="変更年月日"></param>
    /// <param name="変更ユーザ"></param>
    /// <returns></returns>
    public int frmJ_TraineeInterviewList_Insert_Case3(int 応募情報ID, DateTime 登録年月日, int 登録ユーザ, DateTime 変更年月日, int 変更ユーザ)
    {
        if (_frmJ_InterviewResultCheckManager.frmJ_TraineeInterviewList_Insert_Case3(応募情報ID, 登録年月日, 登録ユーザ, 変更年月日, 変更ユーザ) == 1)
            return 1;
        return 0;
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Update data to table 応募状態 with case = 4 (document)
    /// Status: OK
    /// </summary>
    /// <param name="応募情報ID"></param>
    /// <param name="変更年月日"></param>
    /// <param name="変更ユーザ"></param>
    /// <returns></returns>
    public int frmJ_TraineeInterviewList_Update_Case4(int 応募情報ID, DateTime 変更年月日, int 変更ユーザ)
    {
        if (_frmJ_InterviewResultCheckManager.frmJ_TraineeInterviewList_Update_Case4(応募情報ID, 変更年月日, 変更ユーザ) == 1)
            return 1;
        return 0;
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Update data to table 応募状態 with case = 6 (document)
    /// Status: OK
    /// </summary>
    /// <param name="応募情報ID"></param>
    /// <param name="変更年月日"></param>
    /// <param name="変更ユーザ"></param>
    /// <returns></returns>
    public int frmJ_TraineeInterviewList_Update_Case6(int 応募情報ID, DateTime 変更年月日, int 変更ユーザ)
    {
        if (_frmJ_InterviewResultCheckManager.frmJ_TraineeInterviewList_Update_Case6(応募情報ID, 変更年月日, 変更ユーザ) == 1)
            return 1;
        return 0;
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Insert data to table 応募状態 with case = 5 (document)
    /// Status: OK
    /// </summary>
    /// <param name="応募情報ID"></param>
    /// <param name="変更年月日"></param>
    /// <param name="変更ユーザ"></param>
    /// <returns></returns>
    public int frmJ_TraineeInterviewList_Insert_Case5(int 応募情報ID, DateTime 変更年月日, int 変更ユーザ)
    {
        if (_frmJ_InterviewResultCheckManager.frmJ_TraineeInterviewList_Insert_Case5(応募情報ID, 変更年月日, 変更ユーザ) == 1)
            return 1;
        return 0;
    }

    /// <summary>
    /// Coder: Thanh Dong
    /// Function: Insert data to table 応募状態 with case = 7 (document)
    /// Status: OK
    /// </summary>
    /// <param name="応募情報ID"></param>
    /// <param name="変更年月日"></param>
    /// <param name="変更ユーザ"></param>
    /// <returns></returns>
    public int frmJ_TraineeInterviewList_Insert_Case7(int 応募情報ID, DateTime 変更年月日, int 変更ユーザ)
    {
        if (_frmJ_InterviewResultCheckManager.frmJ_TraineeInterviewList_Insert_Case7(応募情報ID, 変更年月日, 変更ユーザ) == 1)
            return 1;
        return 0;
    }
}
